#define DEBUG
#include <cstdio>
#include <cmath>

using namespace std;

const int inf=0x7ffffff;

int min(int a, int b) {
  return a<b ? a : b;
}

int sqr(int a) {
  return a*a;
}

int calc(int p1, int p2, int x1, int y1, int x2, int y2) {
  return (p1!=0 || p2!=0) ? sqr(p1)*(sqr(x1)+sqr(y1))+2*p1*p2*(x1*x2+y1*y2)+sqr(p2)*(sqr(x2)+sqr(y2)) : inf;
}

int solve(int p2, int x1, int y1, int x2, int y2) {
  double h=(double)-p2*(x1*x2+y1*y2)/(sqr(x1)+sqr(y1));
  int h1=floor(h), h2=ceil(h);
  return min(calc(h1, p2, x1, y1, x2, y2), calc(h2, p2, x1, y1, x2, y2));
}

int main() {
  freopen("math.in", "r", stdin);
  freopen("math.out", "w", stdout);

  int x1, x2, y1, y2;
  for (; scanf("%d %d %d %d", &x1, &y1, &x2, &y2)!=EOF; ) {
    int ans=inf;
    for (int i=-30; i<=30; i++) {
      ans = min(ans, min(solve(i, x1, y1, x2, y2), solve(i, x2, y2, x1, y1)));
    }
    printf("%d\n", ans);
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
